// package vip.liux.contracts.security.externalLogin;
//
// import lombok.Setter;
// import org.springframework.security.authentication.AuthenticationProvider;
// import org.springframework.security.core.Authentication;
// import org.springframework.security.core.AuthenticationException;
// import org.springframework.security.provisioning.UserDetailsManager;
// import vip.liux.contracts.security.externalLogin.authenticator.ExternalLoginAuthenticator;
// import vip.liux.contracts.security.externalLogin.authenticator.FacebookLoginAuthenticator;
// import vip.liux.contracts.security.externalLogin.authenticator.GoogleLoginAuthenticator;
//
// import java.util.HashMap;
// import java.util.Map;
// @Deprecated
// public class ExternalLoginAuthenticationProviderDeprecated implements AuthenticationProvider {
//
//     private final Map<String, ExternalLoginAuthenticator> authenticators = new HashMap<>();
//
//     @Setter
//     private UserDetailsManager userDetailsManager;
//
//     public ExternalLoginAuthenticationProvider() {
//         authenticators.put("GOOGLE", new GoogleLoginAuthenticator());
//         authenticators.put("FACEBOOK", new FacebookLoginAuthenticator());
//         // 添加其他提供者
//     }
//
//     @Override
//     public Authentication authenticate(Authentication authentication) throws AuthenticationException {
//         if (!(authentication instanceof ExternalLoginAuthenticationToken token)) {
//             return null;
//         }
//
//         String provider = token.getProvider();
//         String externalToken = token.getExternalToken();
//
//         ExternalLoginAuthenticator authenticator = authenticators.get(provider.toUpperCase());
//         if (authenticator == null || !authenticator.authenticate(externalToken)) {
//             throw new AuthenticationException("Authentication failed for provider: " + provider) {
//             };
//         }
//
//         // 返回认证后的令牌
//         return new ExternalLoginAuthenticationToken(provider, externalToken, token.getAuthorities());
//     }
//
//     @Override
//     public boolean supports(Class<?> authentication) {
//         return ExternalLoginAuthenticationToken.class.isAssignableFrom(authentication);
//     }
//
// }